package cn.lg.soar.general.feign;

import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.general.api.constant.ModuleConst;
import cn.lg.soar.general.api.model.RegionDTO;
import cn.lg.soar.general.api.service.IRegionApi;
import cn.lg.soar.general.feign.fallback.RegionApiFallbackFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 区域接口
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ConditionalOnMissingClass("cn.lg.soar.general.client.RegionApiClient")
@ApiClient
@FeignClient(
        name= ModuleConst.MODULE_NAME,
        path= ModuleConst.CLIENT_PATH + "/region",
        fallbackFactory= RegionApiFallbackFactory.class,
        contextId="RegionApiFeign"
)
public interface RegionApiFeign extends IRegionApi {

    @GetMapping("getById")
    @Override
    RegionDTO getById(@RequestParam("id") int id);

    @GetMapping("listByIds")
    @Override
    List<RegionDTO> listByIds(@RequestParam("ids") Collection<Integer> ids);

    @GetMapping("getRegionPath")
    @Override
    List<RegionDTO> getRegionPath(@RequestParam("id") int id);

    @GetMapping("getNameList")
    @Override
    List<String> getNameList(@RequestParam("id") int id);

    @GetMapping("getNameListMap")
    @Override
    Map<Integer, List<String>> getNameListMap(@RequestParam("ids") Collection<Integer> ids);

}
